/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.gianluca.sagrafx.entities;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author eginfer
 */
@Entity
@Table(name = "ordini")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Ordini.findAll", query = "SELECT o FROM Ordini o"),
    @NamedQuery(name = "Ordini.findById", query = "SELECT o FROM Ordini o WHERE o.id = :id"),
    @NamedQuery(name = "Ordini.findByTimestamp", query = "SELECT o FROM Ordini o WHERE o.timestamp = :timestamp"),
    @NamedQuery(name = "Ordini.findByQuantita", query = "SELECT o FROM Ordini o WHERE o.quantita = :quantita")})
public class Ordini implements Serializable {
    @Column(name = "timestamp")
    private BigInteger timestamp;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "quantita")
    private Integer quantita;
    @JoinColumn(name = "idPietanza", referencedColumnName = "ID")
    @ManyToOne
    private Pietanze idPietanza;

    public Ordini() {
    }

    public Ordini(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getQuantita() {
        return quantita;
    }

    public void setQuantita(Integer quantita) {
        this.quantita = quantita;
    }

    public Pietanze getIdPietanza() {
        return idPietanza;
    }

    public void setIdPietanza(Pietanze idPietanza) {
        this.idPietanza = idPietanza;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ordini)) {
            return false;
        }
        Ordini other = (Ordini) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.gianluca.sagrafx.entities.Ordini[ id=" + id + " ]";
    }

    public BigInteger getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(BigInteger timestamp) {
        this.timestamp = timestamp;
    }
    
}
